Overload a function created by returning it to capture static variables